/*
 * Class representing a book of a library
 * @author M.T. Segarra
 * @version 0.0.1
 */
package dvdsManagement;


import java.util.*;

import exceptions.*;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: Dvd
 *
 */

@Entity
@DiscriminatorValue("Dvd")
@NamedQuery(name="findAllDvds", query="select d from Dvd d")
public class Dvd extends mediasManagement.Media implements java.io.Serializable {   

	// Fields
	/**
     * @uml.property name="directors"
     */
    @Transient
    private ArrayList<String> directors;
    
    
	public ArrayList<String> getDirectors() {
		return directors;
	}

	public void setDirectors(ArrayList<String> directors) {
		this.directors = directors;
	}

	/*
	 * Two dvds are equal if their ISAN is the same
	 */
	@Override
	public boolean equals(Object dvd) {
		if (dvd == null)
			return false;
		Dvd d = (Dvd) dvd;

		if (d.isbnOrIsan == isbnOrIsan)
			return true;

		return false;
	}

	public Dvd(){};

	/**
	 * Creates a dvd. All parameters should be given
	 *
	 * @param title
	 *            the title of the dvd
	 * @param editionDate
	 *            date of the edition of the dvd
	 * @param isan
	 *            ISAN of the dvd
	 * @throws BadParametersException
	 * @throws MediaExistsException 
	 */
	public Dvd(String title, Calendar editionDate,
			java.lang.String isbnOrIsan, Integer specimens, ArrayList<String> directors) throws BadParametersException, MediaExistsException {
		super(title, editionDate, "Dvd", isbnOrIsan, specimens);
		this.directors = directors;
	}
}


